{
 "cells": [
  {
   "cell_type": "code",
   "id": "initial_id",
   "metadata": {
    "collapsed": true,
    "ExecuteTime": {
     "end_time": "2024-10-31T06:34:23.442885Z",
     "start_time": "2024-10-31T06:34:23.434889Z"
    }
   },
   "source": [
    "import pandas as pd\n",
    "from datetime import datetime\n",
    "import matplotlib.pyplot as plt\n",
    "import numpy as np\n",
    "import torch\n",
    "import seaborn as sns\n",
    "import math"
   ],
   "outputs": [],
   "execution_count": 6
  },
  {
   "metadata": {
    "ExecuteTime": {
     "end_time": "2024-10-31T06:34:23.457888Z",
     "start_time": "2024-10-31T06:34:23.444885Z"
    }
   },
   "cell_type": "code",
   "source": [
    "data_file_15 = './data/15_03.csv'\n",
    "data_file_21 = './data/21_03.csv'\n",
    "save_file_15 = './data/15_04.csv'\n",
    "save_file_21 = './data/21_04.csv'"
   ],
   "id": "992735f91eda64c",
   "outputs": [],
   "execution_count": 7
  },
  {
   "metadata": {
    "ExecuteTime": {
     "end_time": "2024-10-31T06:34:24.789046Z",
     "start_time": "2024-10-31T06:34:23.458885Z"
    }
   },
   "cell_type": "code",
   "source": [
    "df_15 = pd.read_csv(data_file_15)\n",
    "df_21 = pd.read_csv(data_file_21)"
   ],
   "id": "670bdb7dcc049b82",
   "outputs": [],
   "execution_count": 8
  },
  {
   "metadata": {
    "ExecuteTime": {
     "end_time": "2024-10-31T06:34:24.803858Z",
     "start_time": "2024-10-31T06:34:24.790042Z"
    }
   },
   "cell_type": "code",
   "source": [
    "    \n",
    "power = 'power'\n",
    "generator_speed = 'generator_speed'\n",
    "wind_speed = 'wind_speed'\n",
    "int_tmp = 'int_tmp'\n",
    "environment_tmp = 'environment_tmp'\n",
    "\n",
    "# 温差\n",
    "tmp_diff = 'tmp_diff'\n",
    "# 扭矩\n",
    "torque = 'torque'\n",
    "# 功率系数\n",
    "cp = 'cp'  \n",
    "# 推力系数\n",
    "ct = 'ct'\n",
    "# 速率比\n",
    "_lambda = 'lambda'\n",
    "    \n",
    "def add_new_features(row):\n",
    "    \n",
    "    row[tmp_diff] = row[int_tmp] - row[environment_tmp]\n",
    "    row[torque] = row[power] / row[generator_speed]\n",
    "    row[cp] = row[power] / row[wind_speed] ** 3\n",
    "    row[ct] = row[torque] / row[wind_speed] ** 2\n",
    "    row[_lambda] = row[generator_speed] / row[wind_speed]\n",
    "    return row"
   ],
   "id": "988ac4813fefa38c",
   "outputs": [],
   "execution_count": 9
  },
  {
   "metadata": {
    "ExecuteTime": {
     "end_time": "2024-10-31T06:44:51.080811Z",
     "start_time": "2024-10-31T06:34:24.804866Z"
    }
   },
   "cell_type": "code",
   "source": [
    "df_15 = df_15.apply(add_new_features, axis=1)\n",
    "df_21 = df_21.apply(add_new_features, axis=1)"
   ],
   "id": "b0820797fa2a1d41",
   "outputs": [],
   "execution_count": 10
  },
  {
   "metadata": {
    "ExecuteTime": {
     "end_time": "2024-10-31T06:52:50.648968Z",
     "start_time": "2024-10-31T06:52:50.542775Z"
    }
   },
   "cell_type": "code",
   "source": "df_15",
   "id": "72ec5919163ebf8b",
   "outputs": [
    {
     "data": {
      "text/plain": [
       "                       time  wind_speed  generator_speed     power  \\\n",
       "0       2015-11-01 20:20:16    1.859993         1.223595  2.515790   \n",
       "1       2015-11-01 20:20:23    1.911625         1.293394  2.313551   \n",
       "2       2015-11-01 20:20:30    1.635027         1.280099  2.507799   \n",
       "3       2015-11-01 20:20:37    1.786234         1.280099  2.349593   \n",
       "4       2015-11-01 20:20:47    1.786234         1.263480  2.321566   \n",
       "...                     ...         ...              ...       ...   \n",
       "393881  2016-01-01 21:37:32   -0.113069        -1.179516 -0.883126   \n",
       "393882  2016-01-01 21:37:39    0.034450        -1.136307 -0.871127   \n",
       "393883  2016-01-01 21:37:46    0.292608        -1.129659 -0.877126   \n",
       "393884  2016-01-01 21:37:53   -0.035621        -1.159574 -0.877126   \n",
       "393885  2016-01-01 21:38:01    0.226224        -1.166221 -0.863113   \n",
       "\n",
       "        wind_direction  wind_direction_mean  yaw_position  yaw_speed  \\\n",
       "0            -2.072739            -2.073627     -0.655343   0.030804   \n",
       "1            -2.010591            -1.615140     -0.655343   0.030804   \n",
       "2            -2.053750            -0.282742     -0.649566   0.170338   \n",
       "3            -2.007138            -2.234477     -0.655343  -0.004080   \n",
       "4            -2.264365            -1.428959     -0.637917   0.414524   \n",
       "...                ...                  ...           ...        ...   \n",
       "393881        0.033416             0.826745     -0.742660  -0.527336   \n",
       "393882        0.145629             0.330262     -0.742660  -0.457568   \n",
       "393883       -0.085703            -1.540414     -0.731058  -0.073848   \n",
       "393884       -0.622600            -1.442891     -0.731058  -0.073848   \n",
       "393885       -0.803867            -0.487921     -0.725234   0.100571   \n",
       "\n",
       "        pitch1_angle  pitch2_angle  ...  pitch_angle_sd  pitch_speed_mean  \\\n",
       "0           0.555556      0.506667  ...        0.164422         -1.693333   \n",
       "1           0.195556      0.133333  ...        0.186312          0.000000   \n",
       "2           0.964444      0.951111  ...        0.082395         -1.786667   \n",
       "3           0.168889      0.137778  ...        0.144926          0.000000   \n",
       "4           0.182222      0.168889  ...        0.134022          0.000000   \n",
       "...              ...           ...  ...             ...               ...   \n",
       "393881      0.204444      0.195556  ...        0.071638          0.000000   \n",
       "393882      0.204444      0.195556  ...        0.071638          0.000000   \n",
       "393883      0.204444      0.195556  ...        0.071638          0.000000   \n",
       "393884      0.204444      0.195556  ...        0.071638          0.000000   \n",
       "393885      0.204444      0.195556  ...        0.071638          0.000000   \n",
       "\n",
       "        pitch_speed_sd  pitch_moto_tmp_mean  pitch_moto_tmp_sd  tmp_diff  \\\n",
       "0             0.151967             0.649667           0.307924  0.418837   \n",
       "1             0.000000             0.659333           0.308352  0.418986   \n",
       "2             0.358583             0.662333           0.303934  0.418986   \n",
       "3             0.000000             0.676333           0.299910  0.401627   \n",
       "4             0.000000             0.676333           0.299910  0.418837   \n",
       "...                ...                  ...                ...       ...   \n",
       "393881        0.000000            -1.853000           0.146211 -0.045297   \n",
       "393882        0.000000            -1.853000           0.146211 -0.045297   \n",
       "393883        0.000000            -1.853000           0.146211 -0.066331   \n",
       "393884        0.000000            -1.853000           0.146211 -0.045297   \n",
       "393885        0.000000            -1.853000           0.146211 -0.050551   \n",
       "\n",
       "          torque            cp          ct     lambda  \n",
       "0       2.056065      0.390967    0.594311   0.657849  \n",
       "1       1.788744      0.331185    0.489489   0.676594  \n",
       "2       1.959066      0.573743    0.732823   0.782922  \n",
       "3       1.835478      0.412266    0.575271   0.716647  \n",
       "4       1.837438      0.407348    0.575885   0.707343  \n",
       "...          ...           ...         ...        ...  \n",
       "393881  0.748718    610.935996   58.564438  10.431860  \n",
       "393882  0.766630 -21306.611351  645.963217 -32.984249  \n",
       "393883  0.776452    -35.011061    9.068666  -3.860663  \n",
       "393884  0.756422  19405.743750  596.132242  32.552750  \n",
       "393885  0.740093    -74.550426   14.461333  -5.155156  \n",
       "\n",
       "[393886 rows x 41 columns]"
      ],
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>time</th>\n",
       "      <th>wind_speed</th>\n",
       "      <th>generator_speed</th>\n",
       "      <th>power</th>\n",
       "      <th>wind_direction</th>\n",
       "      <th>wind_direction_mean</th>\n",
       "      <th>yaw_position</th>\n",
       "      <th>yaw_speed</th>\n",
       "      <th>pitch1_angle</th>\n",
       "      <th>pitch2_angle</th>\n",
       "      <th>...</th>\n",
       "      <th>pitch_angle_sd</th>\n",
       "      <th>pitch_speed_mean</th>\n",
       "      <th>pitch_speed_sd</th>\n",
       "      <th>pitch_moto_tmp_mean</th>\n",
       "      <th>pitch_moto_tmp_sd</th>\n",
       "      <th>tmp_diff</th>\n",
       "      <th>torque</th>\n",
       "      <th>cp</th>\n",
       "      <th>ct</th>\n",
       "      <th>lambda</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>0</th>\n",
       "      <td>2015-11-01 20:20:16</td>\n",
       "      <td>1.859993</td>\n",
       "      <td>1.223595</td>\n",
       "      <td>2.515790</td>\n",
       "      <td>-2.072739</td>\n",
       "      <td>-2.073627</td>\n",
       "      <td>-0.655343</td>\n",
       "      <td>0.030804</td>\n",
       "      <td>0.555556</td>\n",
       "      <td>0.506667</td>\n",
       "      <td>...</td>\n",
       "      <td>0.164422</td>\n",
       "      <td>-1.693333</td>\n",
       "      <td>0.151967</td>\n",
       "      <td>0.649667</td>\n",
       "      <td>0.307924</td>\n",
       "      <td>0.418837</td>\n",
       "      <td>2.056065</td>\n",
       "      <td>0.390967</td>\n",
       "      <td>0.594311</td>\n",
       "      <td>0.657849</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1</th>\n",
       "      <td>2015-11-01 20:20:23</td>\n",
       "      <td>1.911625</td>\n",
       "      <td>1.293394</td>\n",
       "      <td>2.313551</td>\n",
       "      <td>-2.010591</td>\n",
       "      <td>-1.615140</td>\n",
       "      <td>-0.655343</td>\n",
       "      <td>0.030804</td>\n",
       "      <td>0.195556</td>\n",
       "      <td>0.133333</td>\n",
       "      <td>...</td>\n",
       "      <td>0.186312</td>\n",
       "      <td>0.000000</td>\n",
       "      <td>0.000000</td>\n",
       "      <td>0.659333</td>\n",
       "      <td>0.308352</td>\n",
       "      <td>0.418986</td>\n",
       "      <td>1.788744</td>\n",
       "      <td>0.331185</td>\n",
       "      <td>0.489489</td>\n",
       "      <td>0.676594</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2</th>\n",
       "      <td>2015-11-01 20:20:30</td>\n",
       "      <td>1.635027</td>\n",
       "      <td>1.280099</td>\n",
       "      <td>2.507799</td>\n",
       "      <td>-2.053750</td>\n",
       "      <td>-0.282742</td>\n",
       "      <td>-0.649566</td>\n",
       "      <td>0.170338</td>\n",
       "      <td>0.964444</td>\n",
       "      <td>0.951111</td>\n",
       "      <td>...</td>\n",
       "      <td>0.082395</td>\n",
       "      <td>-1.786667</td>\n",
       "      <td>0.358583</td>\n",
       "      <td>0.662333</td>\n",
       "      <td>0.303934</td>\n",
       "      <td>0.418986</td>\n",
       "      <td>1.959066</td>\n",
       "      <td>0.573743</td>\n",
       "      <td>0.732823</td>\n",
       "      <td>0.782922</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>3</th>\n",
       "      <td>2015-11-01 20:20:37</td>\n",
       "      <td>1.786234</td>\n",
       "      <td>1.280099</td>\n",
       "      <td>2.349593</td>\n",
       "      <td>-2.007138</td>\n",
       "      <td>-2.234477</td>\n",
       "      <td>-0.655343</td>\n",
       "      <td>-0.004080</td>\n",
       "      <td>0.168889</td>\n",
       "      <td>0.137778</td>\n",
       "      <td>...</td>\n",
       "      <td>0.144926</td>\n",
       "      <td>0.000000</td>\n",
       "      <td>0.000000</td>\n",
       "      <td>0.676333</td>\n",
       "      <td>0.299910</td>\n",
       "      <td>0.401627</td>\n",
       "      <td>1.835478</td>\n",
       "      <td>0.412266</td>\n",
       "      <td>0.575271</td>\n",
       "      <td>0.716647</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>4</th>\n",
       "      <td>2015-11-01 20:20:47</td>\n",
       "      <td>1.786234</td>\n",
       "      <td>1.263480</td>\n",
       "      <td>2.321566</td>\n",
       "      <td>-2.264365</td>\n",
       "      <td>-1.428959</td>\n",
       "      <td>-0.637917</td>\n",
       "      <td>0.414524</td>\n",
       "      <td>0.182222</td>\n",
       "      <td>0.168889</td>\n",
       "      <td>...</td>\n",
       "      <td>0.134022</td>\n",
       "      <td>0.000000</td>\n",
       "      <td>0.000000</td>\n",
       "      <td>0.676333</td>\n",
       "      <td>0.299910</td>\n",
       "      <td>0.418837</td>\n",
       "      <td>1.837438</td>\n",
       "      <td>0.407348</td>\n",
       "      <td>0.575885</td>\n",
       "      <td>0.707343</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>...</th>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>393881</th>\n",
       "      <td>2016-01-01 21:37:32</td>\n",
       "      <td>-0.113069</td>\n",
       "      <td>-1.179516</td>\n",
       "      <td>-0.883126</td>\n",
       "      <td>0.033416</td>\n",
       "      <td>0.826745</td>\n",
       "      <td>-0.742660</td>\n",
       "      <td>-0.527336</td>\n",
       "      <td>0.204444</td>\n",
       "      <td>0.195556</td>\n",
       "      <td>...</td>\n",
       "      <td>0.071638</td>\n",
       "      <td>0.000000</td>\n",
       "      <td>0.000000</td>\n",
       "      <td>-1.853000</td>\n",
       "      <td>0.146211</td>\n",
       "      <td>-0.045297</td>\n",
       "      <td>0.748718</td>\n",
       "      <td>610.935996</td>\n",
       "      <td>58.564438</td>\n",
       "      <td>10.431860</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>393882</th>\n",
       "      <td>2016-01-01 21:37:39</td>\n",
       "      <td>0.034450</td>\n",
       "      <td>-1.136307</td>\n",
       "      <td>-0.871127</td>\n",
       "      <td>0.145629</td>\n",
       "      <td>0.330262</td>\n",
       "      <td>-0.742660</td>\n",
       "      <td>-0.457568</td>\n",
       "      <td>0.204444</td>\n",
       "      <td>0.195556</td>\n",
       "      <td>...</td>\n",
       "      <td>0.071638</td>\n",
       "      <td>0.000000</td>\n",
       "      <td>0.000000</td>\n",
       "      <td>-1.853000</td>\n",
       "      <td>0.146211</td>\n",
       "      <td>-0.045297</td>\n",
       "      <td>0.766630</td>\n",
       "      <td>-21306.611351</td>\n",
       "      <td>645.963217</td>\n",
       "      <td>-32.984249</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>393883</th>\n",
       "      <td>2016-01-01 21:37:46</td>\n",
       "      <td>0.292608</td>\n",
       "      <td>-1.129659</td>\n",
       "      <td>-0.877126</td>\n",
       "      <td>-0.085703</td>\n",
       "      <td>-1.540414</td>\n",
       "      <td>-0.731058</td>\n",
       "      <td>-0.073848</td>\n",
       "      <td>0.204444</td>\n",
       "      <td>0.195556</td>\n",
       "      <td>...</td>\n",
       "      <td>0.071638</td>\n",
       "      <td>0.000000</td>\n",
       "      <td>0.000000</td>\n",
       "      <td>-1.853000</td>\n",
       "      <td>0.146211</td>\n",
       "      <td>-0.066331</td>\n",
       "      <td>0.776452</td>\n",
       "      <td>-35.011061</td>\n",
       "      <td>9.068666</td>\n",
       "      <td>-3.860663</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>393884</th>\n",
       "      <td>2016-01-01 21:37:53</td>\n",
       "      <td>-0.035621</td>\n",
       "      <td>-1.159574</td>\n",
       "      <td>-0.877126</td>\n",
       "      <td>-0.622600</td>\n",
       "      <td>-1.442891</td>\n",
       "      <td>-0.731058</td>\n",
       "      <td>-0.073848</td>\n",
       "      <td>0.204444</td>\n",
       "      <td>0.195556</td>\n",
       "      <td>...</td>\n",
       "      <td>0.071638</td>\n",
       "      <td>0.000000</td>\n",
       "      <td>0.000000</td>\n",
       "      <td>-1.853000</td>\n",
       "      <td>0.146211</td>\n",
       "      <td>-0.045297</td>\n",
       "      <td>0.756422</td>\n",
       "      <td>19405.743750</td>\n",
       "      <td>596.132242</td>\n",
       "      <td>32.552750</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>393885</th>\n",
       "      <td>2016-01-01 21:38:01</td>\n",
       "      <td>0.226224</td>\n",
       "      <td>-1.166221</td>\n",
       "      <td>-0.863113</td>\n",
       "      <td>-0.803867</td>\n",
       "      <td>-0.487921</td>\n",
       "      <td>-0.725234</td>\n",
       "      <td>0.100571</td>\n",
       "      <td>0.204444</td>\n",
       "      <td>0.195556</td>\n",
       "      <td>...</td>\n",
       "      <td>0.071638</td>\n",
       "      <td>0.000000</td>\n",
       "      <td>0.000000</td>\n",
       "      <td>-1.853000</td>\n",
       "      <td>0.146211</td>\n",
       "      <td>-0.050551</td>\n",
       "      <td>0.740093</td>\n",
       "      <td>-74.550426</td>\n",
       "      <td>14.461333</td>\n",
       "      <td>-5.155156</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "<p>393886 rows × 41 columns</p>\n",
       "</div>"
      ]
     },
     "execution_count": 11,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "execution_count": 11
  },
  {
   "metadata": {
    "ExecuteTime": {
     "end_time": "2024-10-31T06:59:19.761624Z",
     "start_time": "2024-10-31T06:59:19.751625Z"
    }
   },
   "cell_type": "code",
   "source": [
    "r_wind_speed_to_power = 'r_wind_speed_to_power'\n",
    "r_wind_speed_to_generator_speed = 'r_wind_speed_to_generator_speed'\n",
    "r_square = 'r_square'\n",
    "\n",
    "def add_new_features_2(row):\n",
    "    row[r_wind_speed_to_power] = ((row[wind_speed] + 5) / (row[power] + 5)) ** 2 -1\n",
    "    row[r_wind_speed_to_generator_speed] = ((row[wind_speed] + 5) / (row[generator_speed] + 5)) ** 2 -1\n",
    "    row[r_square] = (((row[wind_speed] + 5) ** 2) / ((row[power] + 5) * (row[generator_speed] + 5))) ** 2 - 1\n",
    "    return row\n",
    "\n"
   ],
   "id": "7071582586d7bcc9",
   "outputs": [],
   "execution_count": 12
  },
  {
   "metadata": {
    "ExecuteTime": {
     "end_time": "2024-10-31T07:04:27.535793Z",
     "start_time": "2024-10-31T06:59:36.945663Z"
    }
   },
   "cell_type": "code",
   "source": [
    "df_15 = df_15.apply(add_new_features_2, axis=1)\n",
    "df_21 = df_21.apply(add_new_features_2, axis=1)"
   ],
   "id": "8d6bcb225e95dff4",
   "outputs": [],
   "execution_count": 13
  },
  {
   "metadata": {
    "ExecuteTime": {
     "end_time": "2024-10-31T07:05:54.450780Z",
     "start_time": "2024-10-31T07:05:54.342054Z"
    }
   },
   "cell_type": "code",
   "source": "df_15",
   "id": "8ff1a5b1cd496d7a",
   "outputs": [
    {
     "data": {
      "text/plain": [
       "                       time  wind_speed  generator_speed     power  \\\n",
       "0       2015-11-01 20:20:16    1.859993         1.223595  2.515790   \n",
       "1       2015-11-01 20:20:23    1.911625         1.293394  2.313551   \n",
       "2       2015-11-01 20:20:30    1.635027         1.280099  2.507799   \n",
       "3       2015-11-01 20:20:37    1.786234         1.280099  2.349593   \n",
       "4       2015-11-01 20:20:47    1.786234         1.263480  2.321566   \n",
       "...                     ...         ...              ...       ...   \n",
       "393881  2016-01-01 21:37:32   -0.113069        -1.179516 -0.883126   \n",
       "393882  2016-01-01 21:37:39    0.034450        -1.136307 -0.871127   \n",
       "393883  2016-01-01 21:37:46    0.292608        -1.129659 -0.877126   \n",
       "393884  2016-01-01 21:37:53   -0.035621        -1.159574 -0.877126   \n",
       "393885  2016-01-01 21:38:01    0.226224        -1.166221 -0.863113   \n",
       "\n",
       "        wind_direction  wind_direction_mean  yaw_position  yaw_speed  \\\n",
       "0            -2.072739            -2.073627     -0.655343   0.030804   \n",
       "1            -2.010591            -1.615140     -0.655343   0.030804   \n",
       "2            -2.053750            -0.282742     -0.649566   0.170338   \n",
       "3            -2.007138            -2.234477     -0.655343  -0.004080   \n",
       "4            -2.264365            -1.428959     -0.637917   0.414524   \n",
       "...                ...                  ...           ...        ...   \n",
       "393881        0.033416             0.826745     -0.742660  -0.527336   \n",
       "393882        0.145629             0.330262     -0.742660  -0.457568   \n",
       "393883       -0.085703            -1.540414     -0.731058  -0.073848   \n",
       "393884       -0.622600            -1.442891     -0.731058  -0.073848   \n",
       "393885       -0.803867            -0.487921     -0.725234   0.100571   \n",
       "\n",
       "        pitch1_angle  pitch2_angle  ...  pitch_moto_tmp_mean  \\\n",
       "0           0.555556      0.506667  ...             0.649667   \n",
       "1           0.195556      0.133333  ...             0.659333   \n",
       "2           0.964444      0.951111  ...             0.662333   \n",
       "3           0.168889      0.137778  ...             0.676333   \n",
       "4           0.182222      0.168889  ...             0.676333   \n",
       "...              ...           ...  ...                  ...   \n",
       "393881      0.204444      0.195556  ...            -1.853000   \n",
       "393882      0.204444      0.195556  ...            -1.853000   \n",
       "393883      0.204444      0.195556  ...            -1.853000   \n",
       "393884      0.204444      0.195556  ...            -1.853000   \n",
       "393885      0.204444      0.195556  ...            -1.853000   \n",
       "\n",
       "        pitch_moto_tmp_sd  tmp_diff    torque            cp          ct  \\\n",
       "0                0.307924  0.418837  2.056065      0.390967    0.594311   \n",
       "1                0.308352  0.418986  1.788744      0.331185    0.489489   \n",
       "2                0.303934  0.418986  1.959066      0.573743    0.732823   \n",
       "3                0.299910  0.401627  1.835478      0.412266    0.575271   \n",
       "4                0.299910  0.418837  1.837438      0.407348    0.575885   \n",
       "...                   ...       ...       ...           ...         ...   \n",
       "393881           0.146211 -0.045297  0.748718    610.935996   58.564438   \n",
       "393882           0.146211 -0.045297  0.766630 -21306.611351  645.963217   \n",
       "393883           0.146211 -0.066331  0.776452    -35.011061    9.068666   \n",
       "393884           0.146211 -0.045297  0.756422  19405.743750  596.132242   \n",
       "393885           0.146211 -0.050551  0.740093    -74.550426   14.461333   \n",
       "\n",
       "           lambda  r_wind_speed_to_power  r_wind_speed_to_generator_speed  \\\n",
       "0        0.657849              -0.166898                         0.214968   \n",
       "1        0.676594              -0.106893                         0.206120   \n",
       "2        0.782922              -0.218983                         0.116227   \n",
       "3        0.716647              -0.147428                         0.167682   \n",
       "4        0.707343              -0.140888                         0.173887   \n",
       "...           ...                    ...                              ...   \n",
       "393881  10.431860               0.409085                         0.636198   \n",
       "393882 -32.984249               0.486761                         0.697848   \n",
       "393883  -3.860663               0.647932                         0.869997   \n",
       "393884  32.552750               0.449872                         0.670979   \n",
       "393885  -5.155156               0.595985                         0.858326   \n",
       "\n",
       "        r_square  \n",
       "0       0.012192  \n",
       "1       0.077194  \n",
       "2      -0.128208  \n",
       "3      -0.004467  \n",
       "4       0.008500  \n",
       "...          ...  \n",
       "393881  1.305542  \n",
       "393882  1.524294  \n",
       "393883  2.081629  \n",
       "393884  1.422706  \n",
       "393885  1.965860  \n",
       "\n",
       "[393886 rows x 44 columns]"
      ],
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>time</th>\n",
       "      <th>wind_speed</th>\n",
       "      <th>generator_speed</th>\n",
       "      <th>power</th>\n",
       "      <th>wind_direction</th>\n",
       "      <th>wind_direction_mean</th>\n",
       "      <th>yaw_position</th>\n",
       "      <th>yaw_speed</th>\n",
       "      <th>pitch1_angle</th>\n",
       "      <th>pitch2_angle</th>\n",
       "      <th>...</th>\n",
       "      <th>pitch_moto_tmp_mean</th>\n",
       "      <th>pitch_moto_tmp_sd</th>\n",
       "      <th>tmp_diff</th>\n",
       "      <th>torque</th>\n",
       "      <th>cp</th>\n",
       "      <th>ct</th>\n",
       "      <th>lambda</th>\n",
       "      <th>r_wind_speed_to_power</th>\n",
       "      <th>r_wind_speed_to_generator_speed</th>\n",
       "      <th>r_square</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>0</th>\n",
       "      <td>2015-11-01 20:20:16</td>\n",
       "      <td>1.859993</td>\n",
       "      <td>1.223595</td>\n",
       "      <td>2.515790</td>\n",
       "      <td>-2.072739</td>\n",
       "      <td>-2.073627</td>\n",
       "      <td>-0.655343</td>\n",
       "      <td>0.030804</td>\n",
       "      <td>0.555556</td>\n",
       "      <td>0.506667</td>\n",
       "      <td>...</td>\n",
       "      <td>0.649667</td>\n",
       "      <td>0.307924</td>\n",
       "      <td>0.418837</td>\n",
       "      <td>2.056065</td>\n",
       "      <td>0.390967</td>\n",
       "      <td>0.594311</td>\n",
       "      <td>0.657849</td>\n",
       "      <td>-0.166898</td>\n",
       "      <td>0.214968</td>\n",
       "      <td>0.012192</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1</th>\n",
       "      <td>2015-11-01 20:20:23</td>\n",
       "      <td>1.911625</td>\n",
       "      <td>1.293394</td>\n",
       "      <td>2.313551</td>\n",
       "      <td>-2.010591</td>\n",
       "      <td>-1.615140</td>\n",
       "      <td>-0.655343</td>\n",
       "      <td>0.030804</td>\n",
       "      <td>0.195556</td>\n",
       "      <td>0.133333</td>\n",
       "      <td>...</td>\n",
       "      <td>0.659333</td>\n",
       "      <td>0.308352</td>\n",
       "      <td>0.418986</td>\n",
       "      <td>1.788744</td>\n",
       "      <td>0.331185</td>\n",
       "      <td>0.489489</td>\n",
       "      <td>0.676594</td>\n",
       "      <td>-0.106893</td>\n",
       "      <td>0.206120</td>\n",
       "      <td>0.077194</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2</th>\n",
       "      <td>2015-11-01 20:20:30</td>\n",
       "      <td>1.635027</td>\n",
       "      <td>1.280099</td>\n",
       "      <td>2.507799</td>\n",
       "      <td>-2.053750</td>\n",
       "      <td>-0.282742</td>\n",
       "      <td>-0.649566</td>\n",
       "      <td>0.170338</td>\n",
       "      <td>0.964444</td>\n",
       "      <td>0.951111</td>\n",
       "      <td>...</td>\n",
       "      <td>0.662333</td>\n",
       "      <td>0.303934</td>\n",
       "      <td>0.418986</td>\n",
       "      <td>1.959066</td>\n",
       "      <td>0.573743</td>\n",
       "      <td>0.732823</td>\n",
       "      <td>0.782922</td>\n",
       "      <td>-0.218983</td>\n",
       "      <td>0.116227</td>\n",
       "      <td>-0.128208</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>3</th>\n",
       "      <td>2015-11-01 20:20:37</td>\n",
       "      <td>1.786234</td>\n",
       "      <td>1.280099</td>\n",
       "      <td>2.349593</td>\n",
       "      <td>-2.007138</td>\n",
       "      <td>-2.234477</td>\n",
       "      <td>-0.655343</td>\n",
       "      <td>-0.004080</td>\n",
       "      <td>0.168889</td>\n",
       "      <td>0.137778</td>\n",
       "      <td>...</td>\n",
       "      <td>0.676333</td>\n",
       "      <td>0.299910</td>\n",
       "      <td>0.401627</td>\n",
       "      <td>1.835478</td>\n",
       "      <td>0.412266</td>\n",
       "      <td>0.575271</td>\n",
       "      <td>0.716647</td>\n",
       "      <td>-0.147428</td>\n",
       "      <td>0.167682</td>\n",
       "      <td>-0.004467</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>4</th>\n",
       "      <td>2015-11-01 20:20:47</td>\n",
       "      <td>1.786234</td>\n",
       "      <td>1.263480</td>\n",
       "      <td>2.321566</td>\n",
       "      <td>-2.264365</td>\n",
       "      <td>-1.428959</td>\n",
       "      <td>-0.637917</td>\n",
       "      <td>0.414524</td>\n",
       "      <td>0.182222</td>\n",
       "      <td>0.168889</td>\n",
       "      <td>...</td>\n",
       "      <td>0.676333</td>\n",
       "      <td>0.299910</td>\n",
       "      <td>0.418837</td>\n",
       "      <td>1.837438</td>\n",
       "      <td>0.407348</td>\n",
       "      <td>0.575885</td>\n",
       "      <td>0.707343</td>\n",
       "      <td>-0.140888</td>\n",
       "      <td>0.173887</td>\n",
       "      <td>0.008500</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>...</th>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>393881</th>\n",
       "      <td>2016-01-01 21:37:32</td>\n",
       "      <td>-0.113069</td>\n",
       "      <td>-1.179516</td>\n",
       "      <td>-0.883126</td>\n",
       "      <td>0.033416</td>\n",
       "      <td>0.826745</td>\n",
       "      <td>-0.742660</td>\n",
       "      <td>-0.527336</td>\n",
       "      <td>0.204444</td>\n",
       "      <td>0.195556</td>\n",
       "      <td>...</td>\n",
       "      <td>-1.853000</td>\n",
       "      <td>0.146211</td>\n",
       "      <td>-0.045297</td>\n",
       "      <td>0.748718</td>\n",
       "      <td>610.935996</td>\n",
       "      <td>58.564438</td>\n",
       "      <td>10.431860</td>\n",
       "      <td>0.409085</td>\n",
       "      <td>0.636198</td>\n",
       "      <td>1.305542</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>393882</th>\n",
       "      <td>2016-01-01 21:37:39</td>\n",
       "      <td>0.034450</td>\n",
       "      <td>-1.136307</td>\n",
       "      <td>-0.871127</td>\n",
       "      <td>0.145629</td>\n",
       "      <td>0.330262</td>\n",
       "      <td>-0.742660</td>\n",
       "      <td>-0.457568</td>\n",
       "      <td>0.204444</td>\n",
       "      <td>0.195556</td>\n",
       "      <td>...</td>\n",
       "      <td>-1.853000</td>\n",
       "      <td>0.146211</td>\n",
       "      <td>-0.045297</td>\n",
       "      <td>0.766630</td>\n",
       "      <td>-21306.611351</td>\n",
       "      <td>645.963217</td>\n",
       "      <td>-32.984249</td>\n",
       "      <td>0.486761</td>\n",
       "      <td>0.697848</td>\n",
       "      <td>1.524294</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>393883</th>\n",
       "      <td>2016-01-01 21:37:46</td>\n",
       "      <td>0.292608</td>\n",
       "      <td>-1.129659</td>\n",
       "      <td>-0.877126</td>\n",
       "      <td>-0.085703</td>\n",
       "      <td>-1.540414</td>\n",
       "      <td>-0.731058</td>\n",
       "      <td>-0.073848</td>\n",
       "      <td>0.204444</td>\n",
       "      <td>0.195556</td>\n",
       "      <td>...</td>\n",
       "      <td>-1.853000</td>\n",
       "      <td>0.146211</td>\n",
       "      <td>-0.066331</td>\n",
       "      <td>0.776452</td>\n",
       "      <td>-35.011061</td>\n",
       "      <td>9.068666</td>\n",
       "      <td>-3.860663</td>\n",
       "      <td>0.647932</td>\n",
       "      <td>0.869997</td>\n",
       "      <td>2.081629</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>393884</th>\n",
       "      <td>2016-01-01 21:37:53</td>\n",
       "      <td>-0.035621</td>\n",
       "      <td>-1.159574</td>\n",
       "      <td>-0.877126</td>\n",
       "      <td>-0.622600</td>\n",
       "      <td>-1.442891</td>\n",
       "      <td>-0.731058</td>\n",
       "      <td>-0.073848</td>\n",
       "      <td>0.204444</td>\n",
       "      <td>0.195556</td>\n",
       "      <td>...</td>\n",
       "      <td>-1.853000</td>\n",
       "      <td>0.146211</td>\n",
       "      <td>-0.045297</td>\n",
       "      <td>0.756422</td>\n",
       "      <td>19405.743750</td>\n",
       "      <td>596.132242</td>\n",
       "      <td>32.552750</td>\n",
       "      <td>0.449872</td>\n",
       "      <td>0.670979</td>\n",
       "      <td>1.422706</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>393885</th>\n",
       "      <td>2016-01-01 21:38:01</td>\n",
       "      <td>0.226224</td>\n",
       "      <td>-1.166221</td>\n",
       "      <td>-0.863113</td>\n",
       "      <td>-0.803867</td>\n",
       "      <td>-0.487921</td>\n",
       "      <td>-0.725234</td>\n",
       "      <td>0.100571</td>\n",
       "      <td>0.204444</td>\n",
       "      <td>0.195556</td>\n",
       "      <td>...</td>\n",
       "      <td>-1.853000</td>\n",
       "      <td>0.146211</td>\n",
       "      <td>-0.050551</td>\n",
       "      <td>0.740093</td>\n",
       "      <td>-74.550426</td>\n",
       "      <td>14.461333</td>\n",
       "      <td>-5.155156</td>\n",
       "      <td>0.595985</td>\n",
       "      <td>0.858326</td>\n",
       "      <td>1.965860</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "<p>393886 rows × 44 columns</p>\n",
       "</div>"
      ]
     },
     "execution_count": 14,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "execution_count": 14
  },
  {
   "metadata": {
    "ExecuteTime": {
     "end_time": "2024-10-31T07:06:34.827503Z",
     "start_time": "2024-10-31T07:06:24.960625Z"
    }
   },
   "cell_type": "code",
   "source": [
    "df_15.to_csv(save_file_15, index=False)\n",
    "df_21.to_csv(save_file_21, index=False)"
   ],
   "id": "9fd3914a0b00f27",
   "outputs": [],
   "execution_count": 15
  },
  {
   "metadata": {},
   "cell_type": "code",
   "outputs": [],
   "execution_count": null,
   "source": "",
   "id": "49643a81d867b2d6"
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Python 3",
   "language": "python",
   "name": "python3"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 2
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython2",
   "version": "2.7.6"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 5
}
